<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link href="{TPL}css/NewTopFoot.css" rel="Stylesheet" type="text/css">
<link type="text/css" rel="stylesheet" href="{TPL}css/AddItemPanel.css">
<link type="text/css" id="styleName" rel="stylesheet" href="{TPL}css/orange/color.css"/ >    
<script type="text/javascript" src="{TPL}js/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="{TPL}js/jQuery.Extend.js"></script>
<script src="{TPL}js/jQuery.Drag.min.js" type="text/javascript"></script>
<script type="text/javascript" src="{TPL}js/jquery.cookies.2.1.0.min.js"></script>
<script src="{TPL}js/Gobal.js" type="text/javascript"></script>
<script type="text/javascript" src="{TPL}js/wdggcGobal.js"></script>
<link type="text/css" rel="stylesheet" href="{TPL}css/changeEmail.css">

 <script type="text/javascript">
        var p1 = "请您输入网站的登录密码";
        var p2 = "密码可由大小写英文字母、数字组成，长度为6-20个字符！";
        var p3 = "请您再次输入新密码";
        var p4 = "请您输入下图中的字符";
        function focusCheck(dom, str) {
            if ($(dom).val().length > 0)
                $(dom).attr("class", "").next("p").attr("class", "").html("");
            else
                $(dom).attr("class", "").next("p").attr("class", "").html(str);
        }
        function ClearnTxt(id, pId, p) {
            if ($(id).val().length > 0) {
                $(pId).html("").attr("class", "");
            }
            else {
                $(pId).html(p).attr("class", "");
            }
        }
        var passwordchecked = false;
        function CheckPassword(id) {
            var password = $.trim($(id).val());
            $(id).next("p").show();
            $("#rank").hide();
            if (password.length > 0) {
                if (password.length < 6 || password.length > 20) {
                    $(id).attr("class", "red").next("p").html("新密码长度必须是6-20个字符！").attr("class", "red");
                    passwordchecked = false;
                }
                else if (!(new RegExp("^(\\w)*$").test(password))) {
                    $(id).attr("class", "red").next("p").html("新密码只能是数字、大小写字母！").attr("class", "red");
                    passwordchecked = false;
                }
                else {
                    $(id).attr("class", "").next("p").html("").attr("class", "");
                    reCheckPassword("#ckeckPasswordTxt");
                    passwordchecked = true;
                }
            }
            else if (password.length == 0 && $(id).val().length > 0) {
                $(id).attr("class", "red").next("p").html("新密码只能是数字、大小写字母！").attr("class", "red");
                passwordchecked = false;
            }
 
        }
        function passPower(dom) {
            var pass = $(dom).val().toLowerCase();
            var powerRank = 0;
            if (pass.length > 2) {
                $(dom).next("p").hide();
                if (pass.length > 2) powerRank++;
                if (new RegExp("[0-9][a-z]|[a-z][0-9]").test(pass)) powerRank++;
                if (new RegExp("[0-9]+[a-z]+[0-9]+[a-z]|[a-z]+[0-9]+[a-z]+[0-9]").test(pass)) powerRank++;
                switch (powerRank) {
                    case 0: $("#rank").attr("class", "rank").text("安全等级：低"); break;
                    case 1: $("#rank").attr("class", "rank").text("安全等级：低"); break;
                    case 2: $("#rank").attr("class", "rank mid").text("安全等级：中"); break;
                    case 3: $("#rank").attr("class", "rank High").text("安全等级：高"); break;
                    default: $("#rank").attr("class", "rank").text("安全等级：低"); break;
                }
                $("#rank").css("display", "inline");
            }
            else {
                $("#rank").hide();
                $(dom).next("p").show();
            }
        }
        var repasschecked = false;
        function reCheckPassword(dom) {
            var rePass = $.trim($(dom).val());
            var rePassNoTrim = $(dom).val();
            if (rePass.length <= 0) {
                if (rePassNoTrim.length > 0)
                    $(dom).attr("class", "red").next("p").attr("class", "red").text("两次密码输入不一致，请重新输入！");
                else
                    $(dom).attr("class", "").next("p").attr("class", "").text(p3);
            } else {
                if ($.trim($("#newPasswordTxt").val()) == rePass) {
                    repasschecked = true;
                }
                else {
                    $(dom).attr("class", "red").next("p").attr("class", "red").text("两次密码输入不一致，请重新输入！");
                    repasschecked = false;
                }
            }
        }
        var checkcodechecked = false;
        function checkCode(dom) {
            var checkCode = $.trim($(dom).val()).toLowerCase();
            if (checkCode == "") {
                $(dom).nextAll("p").html("请您输入下图中的字符"); checkcodechecked = false;
            }
            else {
                $.ajax({
                    type: "GET",
                    url: "m.php?name=changepassword&action=checkcode&code=" + checkCode + "&r=" + new Date(),
                    dataType: "text",
                    timeout: 10000,
                    error: function(a, b, c) {checkcodechecked = true;},
                    success: function(msg) {
                        if (msg == '0') {
                            checkcodechecked = false;
                            $(dom).attr("class", "red").next("p").html("验证码错误，请重新输入！").attr("class", "red");
                        }
                        else {
                            checkcodechecked = true;
                            $(dom).attr("class", "").next("p").html("").attr("class", "");
                        }
                    }
                });
            }
        }
        function CheckForm() {
            var flag = false;
            if ($.trim($("#oldPasswordTxt").val()).length < 1) {
                $("#oldPasswordTxt").attr("class", "red").next("p").html("请您输入网站的登录密码！").attr("class", "red");
                flag = false;
            }
            if ($.trim($("#newPasswordTxt").val()).length < 1) {
                $("#newPasswordTxt").attr("class", "red").next("p").html("请您输入新密码！").attr("class", "red");
                flag = false;
            }
            if ($.trim($("#ckeckPasswordTxt").val()).length < 1) {
                $("#ckeckPasswordTxt").attr("class", "red").next("p").html("请您再次输入新密码！").attr("class", "red");
                flag = false;
            }
            if ($.trim($("#checkTxt").val()).length < 1) {
                $("#checkTxt").attr("class", "red").next("p").html("请您输入下图中的字符").attr("class", "red");
                flag = false;
            }
            if ($.trim($("#oldPasswordTxt").val()).length > 0 && $.trim($("#newPasswordTxt").val()).length > 0 && $.trim($("#ckeckPasswordTxt").val()).length > 0 && $.trim($("#checkTxt").val()).length > 0) {
                flag = true;
            }
            return flag;
        }
 
        function SubmitForm() {
            if (CheckForm()) {
                if (!checkcodechecked) {
                    $.ajax({
                        type: "GET",
                        url: "/m.php?name=changepassword&action=checkcode&code=" + checkCode + "&r=" + new Date(),
                        dataType: "text",
                        timeout: 10000,
                        error: function(a, b, c) { checkcodechecked = true; },
                        success: function(msg) {
                            if (msg == '0') {
                                checkcodechecked = false;
                                $(dom).attr("class", "red").next("p").html("验证码错误，请重新输入！").attr("class", "red");
                            }
                            else {
                                CheckPassword("#newPasswordTxt");
                                reCheckPassword("#ckeckPasswordTxt");
                                if (passwordchecked && repasschecked && checkcodechecked) {
                                    $("form")[0].submit();
                                }
                            }
                        }
                    });
                }
               else
                   $("form")[0].submit();
            }
        }
        function ClearnAll() {
            if (confirm("重新填写将清空表单,确定要重填吗?")) {
                $("#oldPasswordTxt").val("").attr("class", "").next("p").attr("class", "").html(p1);
                $("#newPasswordTxt").val("").attr("class", "").next("p").attr("class", "").html(p2);
                $("#ckeckPasswordTxt").val("").attr("class", "").next("p").attr("class", "").html(p3);
                $("#checkTxt").val("").attr("class", "").next("p").attr("class", "").html(p4);
                $("#regCheckCode").click();
            }
        }
 
        $(document).ready(function() {
            $("#checkTxt").keydown(function(e) {
                if (e.keyCode == 13) SubmitForm();
            })
        });
    </script>
 
<title>{lang Modify}Email -{$cfg_site_name}</title></head>

<body>


{template 'header'}


    <div class="admin">
        <div class="ding">
            <div class="shouye">
                <a href="{url_m.php}" title="我的会员中心"></a>
            </div>
            <div class="lb">
                <div class="weizhi">
                      <b>{lang Location}：</b><a href="{url_m.php}">{lang Member_Center}</a><span>&gt;</span>{lang Change_Password}
                  </div>
                
                <div class="shezhi">
                    <p>
                        <a href="{url_m.php}">{lang My_Member_Center}</a><span>|</span>{lang Setting_style}：</p>
                    <ul>
                        <li onClick="changeStyle('orange')" class="mypanliS1"></li>
                        <li onClick="changeStyle('grey')" class="mypanliS2"></li>
                        <li onClick="changeStyle('blue')" class="mypanliS3"></li>
                    </ul>
                </div>
            </div>
        </div>
		
{template 'member_left'}  
        
    <div class="fill">
        <div class="tou">
            <h2>
                {lang Change_Password}</h2>
            <p>
                {lang account_security_password}</p>
        </div>
		
		
		
		
		
		
      <form id="aspnetForm" action="m.php?name=changepassword" method="post" name="aspnetForm">
	  <input name="action" value="save"  type="hidden"/>	
       <div class="biao">
            <table>
                <tr>
                    <td class="z">
                        {lang Current_password}：
                    </td>
                    <td>
                        <input name="oldPasswordTxt" maxlength="20" type="password" id="oldPasswordTxt" onkeyup="ClearnTxt('#oldPasswordTxt','#oldPassword',p1);"
                            onfocus="focusCheck(this,p1);checkCode('#checkTxt')"  />
                        <p id="oldPassword" >
                           {lang enter_password_site}</p>
                    </td>
                </tr>
                <tr>
                    <td class="z">
                        {lang Set_new_password}：
                    </td>
                    <td>
                        <input name="newPasswordTxt" id="newPasswordTxt" maxlength="20" type="password" onfocus="focusCheck(this,p2);checkCode('#checkTxt')"
                            onkeyup="ClearnTxt('#newPasswordTxt','#newPassword',p2);passPower(this)" onblur="CheckPassword('#newPasswordTxt')"
                             />
                        <p id="newPassword" >
                            {lang Password_letters_characters_length}！</p>
                        <div class="rank mid" id="rank" style="display: none">
                            {lang Password_Strength}：{lang high}</div>
                        <!--强度低class="rank"  强度中class="rank mid"  强度高class="rank High"-->
                    </td>
                </tr>
                <tr>
                    <td class="z">
                        {lang Confirm_NPassword}：
                    </td>
                    <td>
                        <input name="ckeckPasswordTxt" id="ckeckPasswordTxt" maxlength="20" type="password"
                            onfocus="focusCheck(this,p3);checkCode('#checkTxt')" onkeyup="ClearnTxt('#ckeckPasswordTxt','#checkPassword',p3);"
                            onblur="reCheckPassword(this)"  />
                        <p id="checkPassword" >
                            {lang Please_enter_password}</p>
                    </td>
                </tr>
                <tr>
                    <td class="z">
                        {lang code}：
                    </td>
                    <td>
                        <input name="checkTxt" type="text" id="checkTxt" onkeyup="ClearnTxt('#checkTxt','#checkCode',p4);"
                            onfocus="focusCheck(this,p4)" onblur="checkCode(this)" maxlength="4"  />
                        <p id="checkCode" >
                            {lang characters_following_figure}</p>
                    </td>
                </tr>
                <tr>
                    <td class="z">&nbsp;
                        
                    </td>
                    <td>
                        <span>
                            <img border="0" onClick="this.src='includes/code/securimage_show.php?sid={echo md5(time())}&amp;t='+Math.random();" style="vertical-align: middle; cursor: pointer;" alt="验证码" title="点击图片刷新" src="includes/code/securimage_show.php?sid=<?php echo md5(time()) ?>" id="regCheckCode">
                        </span><a onClick="$('#regCheckCode').click();checkCode('#checkTxt')" style="cursor: pointer;">
                            {lang Not_clear_new}？</a>
                    </td>
                </tr>
            </table>
        </div>
        <div class="tijiao">
            <input name="" type="button" value="确认修改" onmouseover="this.className='by'" onmouseout="this.className=''"
                onclick="SubmitForm();" /><a href="javascript:;" onclick="ClearnAll();">[{lang Re_fill}]</a></div>
    </div>
    
        <div class="yj">
        </div>
    </div>
</form>
    
{template 'footer'}

    </form>
</body>
</html>